package com.moyou.weichat.listener;

import com.hyphenate.EMMessageListener;
import com.hyphenate.chat.EMMessage;

import java.util.List;

/**
 * Created by Administrator on 2017/10/19 0019.
 * sj:2017年10月19日14:26:04
 * name: ts
 * 用途：接受消息的监听类
 */

public class ChatEMMessageListener implements EMMessageListener {
    private ChatMessageCallBack chatMessageCallBack;

    public ChatEMMessageListener(ChatMessageCallBack chatMessageCallBack) {
        this.chatMessageCallBack = chatMessageCallBack;
    }

    @Override
    public void onMessageReceived(List<EMMessage> messages) {
        //收到消息
        chatMessageCallBack.onMessageReceived(messages);
    }

    @Override
    public void onCmdMessageReceived(List<EMMessage> messages) {
        //收到透传消息
        chatMessageCallBack.onCmdMessageReceived();
    }

    @Override
    public void onMessageRead(List<EMMessage> messages) {
        //收到已读回执
        chatMessageCallBack.onMessageRead();
    }

    @Override
    public void onMessageDelivered(List<EMMessage> message) {
        //收到已送达回执
        chatMessageCallBack.onMessageDelivered();
    }
    @Override
    public void onMessageRecalled(List<EMMessage> messages) {
        //消息被撤回
        chatMessageCallBack.onMessageRecalled();
    }

    @Override
    public void onMessageChanged(EMMessage message, Object change) {
        //消息状态变动
        chatMessageCallBack.onMessageChanged();
    }

}
